import Vue from "vue";
import "@/components/index.js"; // 注册全局组件
import "./styles/common.scss"; // global css
import App from "./App";
import "@/plugins/element.js";
import vuescroll from "vuescroll";
import "@/directive/customToolTip.js"; // 注册全局指令
// import EventEmitter from '@/model/EventEmitter'
import * as screenVwConstant from "@/config/vw.js";
import router from "./router";
import store from "./store";

Vue.use(vuescroll);

// Vue.prototype.eventBus = new EventEmitter()

window.screenVwConstant = Object.assign({}, screenVwConstant);

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
	el: "#app",
	router,
	store,
	components: { App },
	mounted() {
		window.addEventListener("resize", this.windowResize);
	},
	beforeDestroy() {
		window.removeEventListener("resize", this.windowResize);
	},
	methods: {
		windowResize() {
			window.screenVwConstant.resetConvertRate();
		},
	},
	render: (h) => h(App),
});
